require "sequel"
require "rake/testtask"

Rake::TestTask.new do |t|
  t.libs << "test"
  t.test_files = FileList["test/**/*_test.rb"]
  t.warning = false
end

task default: :test

namespace :db do
  task :migrate, [:version] do |task, args|
    db = Sequel.sqlite("database.sqlite3")
    Sequel.extension :migration
    version = Integer(args[:version]) if args[:version]
    Sequel::Migrator.apply(db, "db/migrations", version)
  end
end
